<%@ page contentType="application/json;charset=UTF-8" isErrorPage="true"%>
<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
<%
	String msg = exception.getMessage();
	StringBuilder stack = new StringBuilder();
	Throwable t = exception;
	while(true){
		stack.append(t.getClass().getName()).append(": ").append(t.getMessage()).append("\n");
		for (StackTraceElement ste : t.getStackTrace()){
			stack.append("    at ").append(ste.toString()).append("\n");
		}
		t = t.getCause();
		if (t == null) {
			break;
		}
		stack.append("Cause by:").append("\n");
	}
%>
{
	"errorType":"500",
	"errorMsg":"<%=StringEscapeUtils.escapeJavaScript(msg) %>",
	"errorStack": "<%=StringEscapeUtils.escapeJavaScript(stack.toString()) %>"
}